﻿// Copyright (c) egmkang wang. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace XServer.SDK
{
    /// <summary>
    /// 这个类用来Hold一个具有共同ID的对象, 防止不正确的代码更新了其中一个实例, 而另外一个实例还存在系统中
    /// For Example:
    /// Handle<Config> config = GetConfig(1000);
    /// ...
    /// ...
    /// 这边更新了Handle<Config>真正指向的对象, 而上面那个config也会获取到最新的值
    /// </summary>
    /// <typeparam name="T">必须是一个引用对象</typeparam>
    public class Handle<T> where T: class
    {
        public T Value = null;

        public Handle()
        {
        }

        public Handle(T v)
        {
            this.Value = v;
        }
    }
}
